import React, { Component } from 'react';
import PropTypes from 'prop-types'
import Item from '../Item';
import './index.css';
export default class List extends Component {
//对组件进行类型和必要性的限制
static propTypes={
  todi:PropTypes.array.isRequired,
  handleCheck:PropTypes.func.isRequired,
  deletedTodo:PropTypes.func.isRequired,
}
  render() {
    //接到上级的传值
    const {todi,handleCheck,deletedTodo}=this.props;
    return (
      <div>
        <ul className="todo-main">
          {todi.map((item,index)=>{
            return <Item key={item.id}{...item} handleCheck={handleCheck} deletedTodo={deletedTodo}/>
          })}
          </ul>
      </div>
    )
  }
}
